#ifndef WZ_DATA_H
#define WZ_DATA_H

#include <string>
#include <map>
#include <iostream>
#include "WZLib/WZLib.h"
#include "Graphics.h"
using namespace std;

namespace wz {
	class node {//This class is pretty much all you need to know here
	public:
		node();
		~node();
		wz::node& operator [] (string key);//This is how you access nodes
		wz::node& operator [] (const char* key);//This is an extra overload to catch certain cases
		map <string, wz::node>::iterator begin();//These are for if you want to iterate
		map <string, wz::node>::iterator end();
		operator bool();// Used for if blocks
		operator double();//Just do (double)some_node to get its value as a double
		operator int();//ditto for these
		operator string();
		operator sprite*();
		void operator = (double value);//You'll never need to use these
		void operator = (int value);
		void operator = (string value);
		void operator = (sprite* value);
		void operator = (wz::node& value);//Nor this
		wz::node* parent;//Nor this, but you can
		void initf();//Nor this
		WZLib::WZImage* image;//Nor this
		void sprite_data(WZLib::WZPNGProperty* png);
	private://These are private for a reason, don't touch them
		bool loaded;
		string name;
		map <std::string, wz::node>* children;
		bool init;
		double realValue;
		string stringValue;
		sprite* spriteValue;
	};
	class top_node {//This is the top node containing all the wz data
	public://Read up on node for more info, they are similar
		top_node();
		~top_node();
		map <std::string, wz::node> children;
		wz::node& operator [] (string key);
		map <std::string, wz::node>::iterator begin();
		map <std::string, wz::node>::iterator end();
	};
	extern top_node top;//And this is the node you will access everything from. wz::top["hai"]
	bool init(string path);//You'll never need this
	bool load(string name);//Nor this
	bool parse_dir(WZLib::WZDirectory* dir, wz::node* cur_node);//Nor any of these
	bool parse_img(WZLib::WZImage* dir, wz::node* cur_node);
	bool parse_sub(WZLib::WZSubProperty* dir, wz::node* cur_node);
	bool parse_int(WZLib::WZCompressedIntProperty* dir, wz::node* cur_node);
	bool parse_canvas(WZLib::WZCanvasProperty* dir, wz::node* cur_node);
	bool parse_convex(WZLib::WZConvexProperty* dir, wz::node* cur_node);
	bool parse_double(WZLib::WZDoubleProperty* dir, wz::node* cur_node);
	bool parse_extended(WZLib::WZExtendedProperty* dir, wz::node* cur_node);
	bool parse_float(WZLib::WZFloatProperty* dir, wz::node* cur_node);
	bool parse_string(WZLib::WZStringProperty* dir, wz::node* cur_node);
	bool parse_short(WZLib::WZUnsignedShortProperty* dir, wz::node* cur_node);
	bool parse_vector(WZLib::WZVectorProperty* dir, wz::node* cur_node);//So just don't touch them okay?
}

#endif